{include file='/public/header'}
  <body>
    <div class="x-body">
        <form class="layui-form">
        <input type="hidden" name="id" value="{$data.id}">
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>登录名
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="username" name="username" value="{$data.username}" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_pass" class="layui-form-label">
                  <span class="x-red">*</span>新密码
              </label>
              <div class="layui-input-inline">
                  <input type="password" id="L_pass" name="password" class="layui-input">
              </div>
          </div>
      </form>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" onclick="update()">保存</button>
        </div>
      </div>
    </div>
    <script>
        layui.use(['form','layer'], function(){
            form = layui.form;
            layer = layui.layer;
            $ = layui.jquery;
        });
        //保存
        function update(){
          var id = parseInt($('input[name="id"]').val());
          var username = $.trim($('input[name="username"]').val());
          var password = $.trim($('input[name="password"]').val());
          $.post('{:url("admins/update")}',$('form').serialize(),function(res){
            if(res.code>0){
              layer.alert(res.msg,{icon:6});
            }else{
              layer.msg(res.msg);
              setTimeout(function(){parent.window.location.reload();},1000);
            }
          },'json');
        }
    </script>
  </body>

</html>